

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>挂载 CephFS ：先决条件 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="用内核驱动挂载 CephFS" href="../mount-using-kernel-driver/" />
    <link rel="prev" title="CephFS 客户端能力" href="../client-auth/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../">Ceph 文件系统</a> &raquo;</li>
        
      <li>挂载 CephFS ：先决条件</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/cephfs/mount-prerequisites.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 文件系统</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../#cephfs">CephFS 入门</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id4">管理</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../#id5">挂载 CephFS</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../client-config-ref/"> 客户端配置选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../client-auth/"> 客户端认证</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#"> 挂载 CephFS: 前提条件</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id1">用哪个 CephFS 客户端？</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id2">挂载 CephFS 的一般先决条件</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../mount-using-kernel-driver/"> 用内核驱动挂载 CephFS 文件系统</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mount-using-fuse/"> 用 FUSE 挂载 CephFS</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-dokan/"> 在 Windows 上挂载 CephFS</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../man/8/cephfs-shell/"> CephFS Shell 的用法</a></li>
<li class="toctree-l3"><a class="reference internal" href="../kernel-features/"> 内核驱动支持的功能</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../man/8/ceph-fuse/"> ceph-fuse 手册页</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../man/8/mount.ceph/"> mount.ceph 手册页</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../man/8/mount.fuse.ceph/"> mount.fuse.ceph 手册页</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../#id6">CephFS 内幕</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id7">故障排除和灾难恢复</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id9">更多细节</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="cephfs">
<h1>挂载 CephFS ：先决条件<a class="headerlink" href="#cephfs" title="Permalink to this headline">¶</a></h1>
<p>要使用 CephFS ，你可以把它挂载到你的本地文件系统下、
或者通过 <a class="reference external" href="../cephfs-shell">cephfs-shell</a> 使用。挂载 CephFS 需要超级用户权限才能发起对它自己的重新挂载（ remount ），之后才能修剪条目。
可以 <a class="reference external" href="../mount-using-kernel-driver">用内核</a> 也可以 <a class="reference external" href="../mount-using-fuse">用 FUSE</a> 挂载 CephFS ，二者各有优劣。
读一下下面的段落，了解一下两种挂载 CephFS 的方式。</p>
<p>要在 Windows 上挂载 CephFS ，请看 <a class="reference external" href="../ceph-dokan">ceph-dokan</a> 。</p>
<div class="section" id="id1">
<h2>用哪个 CephFS 客户端？<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<p>FUSE 客户端是最简便、也最容易升级到与存储集群一致的 Ceph 版本，但是内核客户端的性能通常更好。</p>
<p>遇到缺陷或性能问题时，最好试试另一个客户端，
以甄别此缺陷是否特定于客户端（然后报告给开发者）。</p>
</div>
<div class="section" id="id2">
<h2>挂载 CephFS 的一般先决条件<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
<p>挂载 CephFS 前，确保客户端主机（挂载和使用 CephFS 的地方）上有 Ceph 配置文件的副本（就是 <code class="docutils literal notranslate"><span class="pre">ceph.conf</span></code> ）、
和 CephX 用户的密钥环（有权限访问 MDS 的）。
这些文件必须已经存在于 Ceph MON 主机上。</p>
<ol class="arabic">
<li><p>为客户端生成一份最小化的配置文件，并放到标准位置：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># 在客户端主机上</span>
<span class="n">mkdir</span> <span class="o">-</span><span class="n">p</span> <span class="o">-</span><span class="n">m</span> <span class="mi">755</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">ceph</span>
<span class="n">ssh</span> <span class="p">{</span><span class="n">user</span><span class="p">}</span><span class="o">@</span><span class="p">{</span><span class="n">mon</span><span class="o">-</span><span class="n">host</span><span class="p">}</span> <span class="s2">&quot;sudo ceph config generate-minimal-conf&quot;</span> <span class="o">|</span> <span class="n">sudo</span> <span class="n">tee</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">ceph</span><span class="o">.</span><span class="n">conf</span>
</pre></div>
</div>
<p>另外，你也可以复制整个 conf 文件。只是，
前述方法生成的配置文件只包含最少信息，通常足够了。
要了解更多，见 <a class="reference external" href="../client-auth">客户端认证</a> 和 <a class="reference internal" href="../../rados/configuration/ceph-conf/#bootstrap-options"><span class="std std-ref">自举引导选项</span></a> 。</p>
</li>
<li><p>确保这个 conf 文件的权限没问题：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">chmod</span> <span class="mi">644</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">ceph</span><span class="o">.</span><span class="n">conf</span>
</pre></div>
</div>
</li>
<li><p>创建一个 CephX 用户、并获取它的密钥：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ssh</span> <span class="p">{</span><span class="n">user</span><span class="p">}</span><span class="o">@</span><span class="p">{</span><span class="n">mon</span><span class="o">-</span><span class="n">host</span><span class="p">}</span> <span class="s2">&quot;sudo ceph fs authorize cephfs client.foo / rw&quot;</span> <span class="o">|</span> <span class="n">sudo</span> <span class="n">tee</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">ceph</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">foo</span><span class="o">.</span><span class="n">keyring</span>
</pre></div>
</div>
<p>在前面的命令里，把 <code class="docutils literal notranslate"><span class="pre">cephfs</span></code> 换成你的 CephFS 名字、
<code class="docutils literal notranslate"><span class="pre">foo</span></code> 换成你的 CephX 用户名、
<code class="docutils literal notranslate"><span class="pre">/</span></code> 换成客户端主机被允许访问的 CephFS 路径，
<code class="docutils literal notranslate"><span class="pre">rw</span></code> 分别表示读取和写入权限。另外，
你可以把 MON 主机上的 Ceph 密钥环复制到客户端主机上的 <code class="docutils literal notranslate"><span class="pre">/etc/ceph</span></code> 目录，
但是新建一个客户端主机专用的密钥环更好。
同时，创建一个 CephX 密钥环或客户端后，
在很多机器上都使用相同的客户端也完全没问题。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>如果你运行前面两个命令时遇到两次输密码的提示符，
先运行 <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">ls</span></code> （或者用 sudo 运行个随便什么无关紧要的命令）
再紧接着运行这些命令。</p>
</div>
</li>
<li><p>确保这个密钥环的权限位合适：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">chmod</span> <span class="mi">600</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">ceph</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">foo</span><span class="o">.</span><span class="n">keyring</span>
</pre></div>
</div>
</li>
</ol>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>用内核或 FUSE 挂载前还有些其它的先决条件，
请分别查看相应的文档。</p>
</div>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../mount-using-kernel-driver/" class="btn btn-neutral float-right" title="用内核驱动挂载 CephFS" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../client-auth/" class="btn btn-neutral float-left" title="CephFS 客户端能力" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>